﻿using System;
using System.Collections.Generic;
using System.Web;
using NFinal.Advanced;


namespace WebMvc.App.Web.Default.IndexController
{

    public class IndexAction  : Controller
	{
		public IndexAction(System.IO.TextWriter tw):base(tw){}
		public IndexAction(string fileName) : base(fileName) {}
        [PostHtml("Index-{id}page.htm")]
        public void Index(int id,string name)
        {
            string message = "我是页头,来自viewBag.";//
            App.Common.UserControl.Footer footer = new App.Common.UserControl.Footer();
            footer.message = "我是页角说明,来自控件.";
            
			Write("\r\n<!doctype html>\r\n<html>\r\n<head>\r\n    <script src=\"/App/Content/js/jquery-1.11.2.min.js\"></script>\r\n    <link href=\"/App/Content/css/frame.css\" type=\"text/css\" rel=\"stylesheet\" />\r\n</head>\r\n<body>\r\n");
			Write("\r\n<header class=\"header\">\r\n    NFinal框架:这是头,来自模版\r\n");
			Write(message);
			Write("\r\n</header>   \r\n    <article>\r\n        Hello,NFinal!\r\n");
			Write("\r\n<style>\r\n    .vcode {\r\n        height:22px;\r\n        width:150px;\r\n    }\r\n    .vcode input{\r\n        height:20px;\r\n        border:1px solid #ddd;\r\n        outline:0;\r\n    }\r\n    .vcode img{\r\n        height:22px;\r\n        width:50px;\r\n    }\r\n</style>\r\n<span class=\"vcode\">\r\n    <input type=\"text\" id=\"_vcode\" name=\"_vcode\" onkeyup=\"if (this.value != this.value.toUpperCase()) this.value=this.value.toUpperCase();\">\r\n    <img src=\"");
			Write(_app);
			Write("/Common/VCodeController/GetVerifyImage.htm\" onclick=\"this.src=\'");
			Write(_app);
			Write("/Common/VCodeController/GetVerifyImage.htm\'+\'?_:\'+Math.random();\">\r\n</span>\r\n        <input id=\"sub\" type=\"button\" value=\"验证\"/>\r\n        <script>\r\n            $(document).ready(function () {\r\n                $(\"#sub\").click(function () {\r\n                    $.post(\"/App/Common/VCodeController/VCheck.htm\", { _vcode: $(\"#_vcode\").val() }, function (data) {\r\n                        alert(data);\r\n                    });\r\n                });\r\n            });\r\n        </script>\r\n    </article>\r\n");
			Write("\r\n<footer>\r\n     NFinal框架.这是尾\r\n");
			Write(message);
			Write("\r\n</footer>\r\n</body>\r\n</html>");
        }
    }
}